C     Program EX_0209.FOR
C     Listing 3F - see documentation in TUTOR.SSS
 
$include:'SSSF1.H'
 
      real*8 function rnx(m, s)
$include:'SSSF2.H'
      real*8 m, s, x
  99  x = RN(m, s)
      if (x.lt.0.0) goto 99
      rnx = x
      return
      end
 
      subroutine prime
$include:'SSSF2.H'
      real*8 x, pt, pv, rnx, mean, sd
      common x, pt, pv, mean, sd
 
      call INIQUE(0, 0, 2)
      call inista(1,'Callduration         ', 0,12,2,0.5)
      call inista(2,'Cycletime            ', 0,0,0,0)
      pv = 0.0
      mean = 7.0
      sd = 4.0
      pt = rnx(mean, sd)
      return
      end
 
      Program EX_0209
$include:'SSSF2.H'
      real*8 x, pt, pv, rnx, mean, sd
      common x, pt, pv, mean, sd
      real*8 erm, min, mode, max
      data erm /2.0/, min /1.0/, mode /3.0/, max /4.0/
 
      call prime
  99    if (RA().lt.0.25) then
          x = ER(2, erm)
        else
          x = TR(min, mode, max)
        endif
        call TALLY(1, x)
        pt = pt + x
        call TALLY(2, pt - pv)
        pv = pt
        pt = pt + rnx(mean, sd)
      if (pt.le.120.0) goto 99

      call SUMRY(' ')
      call SUMRY('RESULTS ')
      end
 